package models
{
	import flash.geom.Vector3D;
	
	import mx.collections.ArrayCollection;
	import mx.controls.Image;
	
	[Bindable]
	public class ModelStub
	{	
		// slides
		public var Images:ArrayCollection;
		// original images
		public var FlickrImages:ArrayCollection;
		// displayed 5 images
		public var PreviewImages:ArrayCollection;
		public var CurrentImageIndex:int;
		
		public function ModelStub()
		{
			Images = new ArrayCollection();
			var tmp:Image;
			var i:int;
			for (i=1;i<=5;i++)
			{
				tmp = new Image();
				tmp.load("../resourses/image"+i+".jpg");
				tmp.width =500;
				tmp.height = 500;
				tmp.transformX = tmp.width/2;
				tmp.transformY = tmp.height/2;
				Images.addItem(tmp);			
				
			}
			CurrentImageIndex = 2;
			(Images.getItemAt(CurrentImageIndex) as Image).id = "selected";
			PreviewImages = new ArrayCollection();
			for (i = CurrentImageIndex - 3;i<CurrentImageIndex+3;i++)
			{
				if (i>=0&&i<Images.length)
				PreviewImages.addItem(Images.getItemAt(i));
			}
			FlickrImages = new ArrayCollection()
			for (i=1;i<=5;i++)
			{
				tmp = new Image();
				tmp.load("../resourses/image"+i+".jpg");
				tmp.width =500;
				tmp.height = 500;
				tmp.transformX = tmp.width/2;
				tmp.transformY = tmp.height/2;
				FlickrImages.addItem(tmp);
			}	

		}
		public function updateModel():void
		{
			PreviewImages = new ArrayCollection();
			var i:int;
			for (i = CurrentImageIndex - 3;i<CurrentImageIndex+3;i++)
			{
				if (i>=0&&i<Images.length)
					PreviewImages.addItem(Images.getItemAt(i));
			}
		}
	}
}